package com.xiaobaibai.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.xiaobaibai.valid.AddGroup;
import com.xiaobaibai.valid.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 
 * </p>
 *
 * @author xiaobaibai
 * @since 2020-10-20
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("announcement")
@ApiModel(value="Announcement对象", description="")
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class Announcement implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "公告id")
    @TableId(value = "id", type = IdType.AUTO)
    @Null(message = "新增不可指定id",groups = AddGroup.class)
    @NotNull(message = "修改需指定id",groups = UpdateGroup.class)
    private Integer id;

    @ApiModelProperty(value = "公告标题")
    @TableField("title")
    @NotNull(message = "请输入标题",groups = AddGroup.class)
    private String title;

    @ApiModelProperty(value = "公告内容")
    @TableField("content")
    @NotNull(message = "请输入内容",groups = AddGroup.class)
    @Length(max = 255,message = "内容过长")
    private String content;

    @ApiModelProperty(value = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;

    @ApiModelProperty(value = "修改时间")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;


}
